import request from '../../utils/request'
import { CHANNELS_ACTIVE, CHANNELS_GET } from '../constants'

export const channelsGetAc = (payload) => ({
  type: CHANNELS_GET,
  payload,
})

export const channelsGet = () => {
  return async (dispatch) => {
    const { data } = await request.get('/channels')
    dispatch(channelsGetAc(data.data.channels))
  }
}

export const channelsActive = (id) => ({
  type: CHANNELS_ACTIVE,
  id,
})
